package com.winter.Controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.winter.mapper.FinCpaperMapper;
import com.winter.model.FinCpaper;
import com.winter.service.FinCpaperService;
import com.winter.util.Result;

@RestController
@RequestMapping("v1/finCpaper")
public class FinCpaperController {

    @Autowired
    public FinCpaperService finCpaperService;

    /**
     * 报价平台票据列表
     */
    @GetMapping("/fin_list")
    public Result finCpaperList(Integer pageNumber, Integer pageSize, String direct, String trade_mode, String fund_type, String accept, String userNo, String sortName, String sort, String key) {
        return finCpaperService.queryPageList(pageNumber, pageSize, direct, trade_mode, fund_type, accept, userNo, sortName, sort, key);
    }

    /**
     * 通过id查询报价平台票据信息
     */
    @GetMapping("/fin_id")
    public Result getFinCpaperBean(Long id, String userNo) {
        return finCpaperService.getFinCpaperBean(id, userNo);
    }

    /**
     * 新增报价平台票据
     */
    @PostMapping("/insertCpaper")
    public Result insertCpaperBean(@RequestBody FinCpaper finCpaper) {

        return finCpaperService.insertCpaperBean(finCpaper);

    }

    /**
     * 修改报价平台票据
     */
    @PutMapping("/updateCpaper")
    public Result updateCpaper(@RequestBody FinCpaper finCpaper) {

        return finCpaperService.updateCpaper(finCpaper);

    }

    /**
     * 首页(报价平台列表)
     */
    @GetMapping("/quoteList")
    public Result quoteList(String userNo) {
        return finCpaperService.quoteList(userNo);
    }
}
